package com.jxdinfo.hussar.cloud.module.example.tjjc.towerdataalarm.controller;

import com.jxdinfo.hussar.cloud.module.example.tjjc.towerdataalarm.vo.TowerDataAlarmSearchVO;
import com.jxdinfo.hussar.support.mp.base.controller.HussarBaseController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jxdinfo.hussar.support.audit.core.annotations.AuditLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventGrade;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PostMapping;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerdataalarm.vo.TowerDataAlarmPageVO;
import org.springframework.beans.factory.annotation.Autowired;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerdataalarm.model.TowerDataAlarm;
import com.jxdinfo.hussar.platform.core.base.apiresult.ApiResponse;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerdataalarm.service.TowerDataAlarmService;

import java.util.Map;

/**
 * 塔机报警数据控制器
 */
@RestController(value = "tjjc.towerdataalarm.TowerDataAlarmController")
@AuditLog(moduleName = "塔机报警数据")
@RequestMapping(value = "/tjjc/towerDataAlarm")
public class TowerDataAlarmController extends HussarBaseController<TowerDataAlarm, TowerDataAlarmService> {

    private static final Logger logger = LoggerFactory.getLogger(TowerDataAlarmController.class);

    @Autowired
    private TowerDataAlarmService towerDataAlarmService;

    /**
     * 驾驶舱-塔机今日工作情况-今日报警数量
     *
     * @param towerDataAlarmSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "塔机报警数据", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("findTowerTodayAlarmCount")
    public ApiResponse<Map<String, Long>> findTowerTodayAlarmCount(@RequestBody TowerDataAlarmSearchVO towerDataAlarmSearchVO) {

        if (towerDataAlarmSearchVO == null){
            return null;
        }

        //todo 没有获取项目编号工具类

        return towerDataAlarmService.findTowerTodayAlarmCount(towerDataAlarmSearchVO);
    }
}
